<%@page import="java.util.Locale"%>
<%@page import="java.util.ResourceBundle"%>
<%@page import="java.util.List"%>
<%@page import="entity.Question"%>
<%@page import="entity.Tag"%>
<% 
	request.setCharacterEncoding("utf-8");
	response.setHeader("Content-Type","text/html; charset=utf-8");
	response.setHeader("Vary","Accept-Encoding");
	response.setCharacterEncoding("utf-8");
%>
<%
	HttpSession ss = request.getSession(true);
	ResourceBundle resource = (ResourceBundle) ss.getAttribute("language");
	int currentPage = Integer.valueOf(request.getAttribute("currentPage").toString());
	String language = resource.getString("code"); 
%>
<%
	List<Question> listQuestion = (List<Question>) request.getAttribute("listQuestionTag");
	String tagAlias = request.getAttribute("tagAlias").toString();
	String title = resource.getString("page")+" "+(currentPage+1)+" - "+resource.getString("tag")+" : "+tagAlias;
	String description = title+resource.getString("description");
	String keywords = tagAlias+","+resource.getString("keyword");
	String tag = "tag";
%>
<jsp:include page="layout/header.jsp">
	<jsp:param name="title" value="<%=title %>"/>
	<jsp:param name="tag" value="<%=tag %>"/>
	<jsp:param name="description" value="<%=description %>"/>
	<jsp:param name="keywords" value="<%=keywords %>"/>
	<jsp:param name="language" value="<%=language %>"/>
</jsp:include>

<div class="bd">
	<div class="bl">
		<jsp:include page="element/adv3.jsp"></jsp:include>
		<br /> <br /> <br />
		<h2><%=resource.getString("menu_tag")%>: <a style="font-size: 24px" href="http://wordtrends.net/keyword/<%=tagAlias %>" target="_blank"><%=tagAlias %></a></h2>
		<div class="adt">
			<!-- AddThis Button BEGIN -->
			<div
				class="addthis_toolbox addthis_default_style addthis_32x32_style">
				<a class="addthis_button_preferred_1"></a> <a
					class="addthis_button_preferred_2"></a> <a
					class="addthis_button_preferred_3"></a> <a
					class="addthis_button_preferred_4"></a> <a
					class="addthis_button_compact"></a> <a
					class="addthis_counter addthis_bubble_style"></a>
			</div>

			<script type="text/javascript"
				src="http://s7.addthis.com/js/250/addthis_widget.js#pubid=ra-4d6f3cdb1d190d60"></script>
			<!-- AddThis Button END -->
		</div>
		<div class="adt so">
			<script type="text/javascript"
				src="https://apis.google.com/js/plusone.js"></script>
			<g:plusone size="standard" count="true"></g:plusone>
		</div>
		<div class="clear"></div>
		<ul class="lq">
			<%
				for (Question item : listQuestion) {
			%>
			<li>
				<h1>
					<a href="<%=request.getContextPath()%>/<%=resource.getString("code")%>/question/<%=item.getAlias() %>" title="<%= item.getTitle()%>"><%=item.getTitle() %></a>					
				</h1>
				<p>
					<%=item.getSubContent()%>
				</p> <%
 	for (String tagItem : item.getTags()) {
			%>
				<a href="<%=request.getContextPath()%>/<%=resource.getString("code")%>/tag/<%=tagItem%>"><%=tagItem %></a>
			<%
 		}
 %>
			</li>
			<%
				}
			%>
			<li class="paginate">
				<%
					if(currentPage>0){
					%>							
						<a href="<%=request.getContextPath()%>/<%=resource.getString("code")%>/tag/<%=tagAlias%>/<%=currentPage-1%>">Previous</a>
					<%							
					}
				%>	
				<a href="<%=request.getContextPath()%>/<%=resource.getString("code")%>/tag/<%=tagAlias%>/<%=currentPage+1%>">Next</a>
			</li>
		</ul>
	</div>
	<div class="br">
		<jsp:include page="element/adv2.jsp"></jsp:include>
		<br /> <br />
		<jsp:include page="element/adv2.jsp"></jsp:include>
		<br /> <br />
		<jsp:include page="element/language.jsp">
			<jsp:param name="alias" value="" />
			<jsp:param name="url" value="tag" />
		</jsp:include>
		<jsp:include page="element/other_tag.jsp">
			<jsp:param name="start" value="" />
			<jsp:param name="language" value="" />
		</jsp:include>

	</div>
	<div class="clear"></div>
</div>
<jsp:include page="/layout/footer.jsp">
	<jsp:param name="language" value="<%=language %>" />
</jsp:include>
